<template>
    <el-container>
      <el-header class="no-flex" height="auto">
        搜索头部
      </el-header>
      <div style="margin:10px 10px">
        <el-button type="primary">批量领取</el-button>
      </div>
      <el-main class="nopadding" style="flex:1">
        <el-table row-key="id" :data="publicData" height="500" width="100%" border stripe>
          <el-table-column type="selection" width="55" align="center"/>
          <el-table-column label="学生姓名" prop="name" align="center"/>
          <el-table-column label="联系电话" prop="mobile" align="center" width="150px"/>
          <el-table-column label="微信" prop="wechat" align="center" width="150px"/>
          <el-table-column label="跟进时间" prop="followTime" :formatter="rendererDateTime" align="center" width="170px"/>
          <el-table-column label="渠道" prop="channelName" align="center" width="130px"/>
          <el-table-column label="沟通内容" prop="followContent" width="200px">
            <template #default="{row}">
              <div class="content">
                {{ row.followContent }}
              </div>
            </template>
          </el-table-column>
          <el-table-column label="操作" width="130" fixed="right" align="center">
            <template #default="{row}">
              <el-link
                icon="Tickets"
                type="primary"
                :underline="false"
              >
                查看详情
              </el-link>
              <el-link
                icon="Pointer"
                type="primary"
                :underline="false"
                @click="publicAdd(row.id)"
              >
                领取客户
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </el-main>
    </el-container>
</template>
  
<script setup>
import { ref, onBeforeMount } from 'vue'
//api
import { poolPage  , poolReceive } from './api'
let publicData = ref([]);
//全局设置数据
import config from '@config'

onBeforeMount(()=>{
    getPublick();
})
const getPublick = async ()=>{
    let res = await poolPage();
    publicData.value = res.data.records;
}
const publicAdd = async ( id )=>{
    if( !config.settingEnabled ){
      return ElMessage.info('共有设置关闭');
    }
    let res = await poolReceive(id);
    if( res.code !='200' ) return;
    ElMessage.success('领取成功');
    getPublick();
}

</script>
<style scoped>
  .inline {
    margin-left: 20px;
    display: inline-flex;
    vertical-align: middle;
    width: 35%;
}
  
  .content {
    padding: 3px;
    overflow: hidden;
    width: 180px;
    height: 100%;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  </style>
  